home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
help_jr
/
MATLAB_DIF
< prev
next >
Wrap
Text File
|
1994-10-10
|
4KB
|
124 lines
MATLAB-DIFF:
This file tries to discuss most of the ways in which RLaB is
significantly different from MATLAB. There are a LOT of
differences; the ones listed herein are the major syntactical,
and conceptual differences.
1.) The most significant difference between MATLAB and RLaB is
the fact the RLaB is copyrighted using the GNU Copyleft. This
gives you the user, access to the source code.
2.) The next most significant difference is RLaB's lack of
context sensitive syntax and operational rules. MATLAB is a
very powerful mathematical tool, hopefully RLaB will be as
capable, but with a simpler, more consistent grammar.
3.) RLaB has distinct data types. NUMBERS, STRINGS, FUNCTIONS,
and LISTs have different internal representations, and are
referred to differently by users.
4.) Matrices are indexed with square braces [ ], not ( ). For
example:
in MATLAB:
% Create a matrix
m = [1, 2, 3; 4, 5, 6; 7, 8, 9];
% Add the diagonal elements
d = m(1,1) + m(2,2) + m(3,3)
in RLaB:
// Create a matrix
m = [1, 2, 3; 4, 5, 6;, 7, 8, 9];
// Add the diagonal elements
d = m[1;1] + m[2;2] + m3;3]
This example highlights two other differences. a.) comments a
denoted with `//'. Any text following `//' on a line will be
ignored. b.) the semi-colon, `;' is used as the row - column
separator.
5.) Strings are denoted with the double quote `"' symbol:
string = "this is a sample string"
The `"' is the ONLY delimiter used for strings.
5a.) String matrices in RLaB are composed of a matrix of
string literals. Therefore, the elements of a string matrix
can have different lengths. Note that a matrix, or array of
strings is not merely a reformatted numeric matrix.
6.) Logical and relational statements: RLaB logical and
relational statements use a more C-like syntax. See the help
file `RELATIONAL'.
6.a) Comparison of complex numbers is performed using the
absolute value, or magnitude for < > <= >=, not the real part
only.
7.) Flow control: Again RLaB uses a more C-like syntax for
flow-control statements. See the help files `IF', `WHILE',
`FOR' for more elaboration.
8.) User-function syntax and lack of automatic m-file loading.
RLaB allows users to type in functions interactively, and put
more than one function in an rfile, Also a mixture of global
commands and functions can be mixed in a file. User-functions
can appear anywhere in an r-file, that is, an r-file can
consist of a complete program with self-contained functions.
RLaB DOES NOT automatically load files that end with a `.r'.
To load existing functions/programs the user must explicitly
ask RLaB to load the file by typing `load( "file-name" )', or
by typing `rfile name'.
9.) RLaB plotting functions are supported by Plplot.
10.) RLaB's Vector creation goes like:
start : end : increment
as opposed to MATLAB's
start : increment : end.
11.) RLaB has an imaginary constant, allowing expressions
like:
a = 1 + 2i
Note: MATLAB v4.0 has this feature also
12.) RLaB does not automatically keep the value of the last
statement in the variable called `ans'
13.) The eye( A ) ambiguity (when A is a 1x1 matrix) does not
exist. I believe MATLAB v4.0 has also resolved this.
14.) The 2./A ambiguity does not exist either. `3./A' is the
same as `3 ./ A'. The `.' goes with the `/' operator to form
an element-by-element operator. Again, I believe MATLAB v4.0
has also resolved this.
15.) RLaB's scoping rules are somewhat different from
MATLAB's. By default all variables in the RLaB workspace,
files, and user-functions are global. In functions, variables
can be declared local or global (but default to local), and in
files variables can be declared static.
16.) In general, an attempt was made to follow MATLAB's spirit
with the builtin functions. However, I have made improvements
or deviations were it seemed appropriate. As the RLaB language
was meant to be an evolutionary improvement over the existing
MATLAB language, so are the linear-algebra functions, which
use LAPACK, meant to be an inprovement over LINPACK and
EISPACK.
17.) Left and right division in RLaB return the mininum-norm
solution for an underdetermined set of equations. MATLAB does
something different. MATLAB returns the solution, which has at
most k (the effective rank of the coefficient matrix) nonzero
components per column.